import request from '@/utils/request'
import axios from 'axios'
// 获取当前用户的摄像头列表
export const getCameraListApi = (params) =>
  request.get('/pio-microservice-biz/pio/monitor/camera/list', { params })

// 获取萤石监控地址
export const getUrlApi = (data) =>
  axios.post('https://open.ys7.com/api/lapp/v2/live/address/get', data, {
    headers: { 'Content-Type': 'application/x-www-form-urlencoded' }
  })

// 查询摄像头令牌信息
export const getCameraPageApi = (params) =>
  request.get('/pio-microservice-biz/pio/monitor/camera/token/page', { params })

//回放取流
export const getNewAccessTokenApi = (token) =>
  request.get(
    `/biz-microservice-energy/camera/stream/hk/stream/account/info?accessToken=${token}`
  )
// 查询token列表
export const getVideoListApi = (data) =>
  request.post('/biz-microservice-energy/camera/token/list', data)
// 保存摄像头配置
export const saveCameraApi = (data) =>
  request.post('/pio-microservice-biz/pio/monitor/camera/config/save', data)
// 获取摄像头配置
export const getCameraApi = (split) =>
  request.get(
    `pio-microservice-biz/pio/monitor/camera/config/get?split=${split}`
  )

// 获取乐橙的视频地址
export const getLcUrlApi = (params) =>
  request.get('/pio-microservice-biz/pio/monitor/camera/lc/live/address', {
    params
  })

// 获取海康的视频地址
export const getHkUrlApi = (params) =>
  axios.get('/biz/biz-microservice-energy/camera/stream//hk/streamUrl', {
    params
  })

// 乐橙摄像头控制
export const controlLcCameraApi = (data) =>
  request.post('/pio-microservice-biz/pio/monitor/camera/lc/control/move', data)

// 海康摄像头控制开始
export const controlHkCameraStartApi = (data) =>
  request.post(
    '/biz-microservice-energy/camera/stream/hk/ptz/control/start',
    data
  )

// 海康摄像头控制结束
export const controlHkCameraStopApi = (data) =>
  request.post(
    '/biz-microservice-energy/camera/stream/hk/ptz/control/stop',
    data
  )
